<template>
	<el-form  :model="staffform" label-width="80px">
	
		<el-form-item label="工号">
			<el-input v-model="staffform.staffId"></el-input>
		</el-form-item>
		<el-form-item label="姓名">
			<el-input v-model="staffform.name"></el-input>
		</el-form-item>
		<el-form-item label="性别">
			<el-input v-model="staffform.sex"></el-input>
		</el-form-item>
		<el-form-item label="年龄">
			<el-input v-model="staffform.age"></el-input>
		</el-form-item>
		<el-form-item label="入职时间">
			<el-input v-model="staffform.hiredate"></el-input>
		</el-form-item>
		<el-form-item label="手机号">
			<el-input v-model="staffform.telphone"></el-input>
		</el-form-item>
		<el-form-item label="简介">
			<el-input v-model="staffform.content"></el-input>
		</el-form-item>
		<el-form-item label="备注">
			<el-input v-model="staffform.remarks"></el-input>
		</el-form-item>
		<el-form-item label="用户名">
			<el-input v-model="staffform.username"></el-input>
		</el-form-item>
		<el-form-item label="人员状态">
			<el-input v-model="staffform.status"></el-input>
		</el-form-item>
		<el-form-item label="密码">
			<el-input v-model="staffform.password"></el-input>
		</el-form-item>
		<el-button type="primary" @click="dostaffEdit">提交</el-button>
	</el-form>
</template>
<script>
	export default{
		name:'StaffEdit',
		props:{
			formData:{
				type:Object,
				default:()=>({})
			},
			editVisible:{
				type:Boolean,
			}
		},
		data(){
			return{
				staffform:{
					staffId:'',
					name:'',
					sex:'',
					age:'',
					hiredate:'',
					telphone:'',
					content:'',
					remarks:'',
					username:'',
					status:'',
					password:''
				}
			}
		},
		mounted(){
			this.staffform=this.formData;
			
		},
		methods:{
			dostaffEdit(){
				this.postRequest("/staff/update",this.staffform).then(resp=>{
					if(resp){
						this.$emit("update:editVisible",false);
					}else{
						this.$message.error({message:'编辑失败'});
					}
				})
			}
		},
		watch:{
			formData:{
				deep:true,
				handler(newVal,oldVal){
					this.staffform=newVal
				}
			}
		}
	}
</script>
<style>
</style>
